package com.encryption.feature.doc
{
	import com.encryption.controls.confirm.ConfirmPopUpManager;
	import com.encryption.controls.tip.TipShowManager;
	import com.encryption.framework.logic.ItemChangePageManager;
	import com.encryption.rpc.facade.FileFacade;
	import com.encryption.rpc.facade.RPCFacadeHelper;
	import com.encryption.rpc.model.File;
	
	import mx.rpc.events.ResultEvent;

	public class DocOperationHelper
	{
		public function DocOperationHelper()
		{
		}
		
		public static function viewDoc(file:File):void
		{
			var url:String = file.swfUrl;
			if(url != null && url != "")
				DocViewPopUpManager.centerPopUp(url);
		}
		
		public static function deleteDoc(file:File):void
		{
			ConfirmPopUpManager.centerPopUp(function():void{
				new FileFacade(FileFacade.OPERATION_DETETE_FILE, {arg0:file.id}, deleteFileHandle);
			});
		}
		
		private function deleteFileHandle(event:RPCEvent):void
		{
			RPCFacadeHelper.rpcHandle(event, function(resultEvent:ResultEvent):void{
				TipShowManager.showMessageTip("删除成功");
				ItemChangePageManager.instance.getChangePage(
			}, "删除失败");
		}
		
		public static function downloadDoc(file:File):void
		{
			
		}
		
		public static function printDoc(file:File):void
		{
			
		}
	}
}